#e[Stage]
#Title[GIGA SERIOUS]
#Text[



Ver0.03]
#Image[]
#Player[.\player_psy\psy.txt]
#ScriptVersion[2]

script_stage_main
{
	let ix		=GetClipMinX;
	let mx		=GetClipMaxX;
	let iy		=GetClipMinY;
	let my		=GetClipMaxY;
	let cx		=GetCenterX;
	let cy		=GetCenterY;
	let nx		=0;
	let ny		=0;
	let GP		=0;
	let BS		=0;
	let BS_S	=0;
	let yyA		=0;
	let yyB		=0;
	let yyC		=0;
	let BGS01	=5;
	let BGS02	=3;
	let BGS03	=2;
	let BGC		=false;
	let D		=0;
	let po		=0;
	let Alpha_result=0;
	let AlphaCount	=0;
	let Alpha_tm	=0;
	let Alpha_tmb	=255;
	let pBonus	=0;
	let Point	=0;
	let GameStart	=0;
	let stage	=0;
	let Result	=false;
	let mCount	=0;
	let time1	=0;
	let NoShot1	=0;

	let Scr 	=0;
	let SOv 	= 0;
	let Cnt 	=0;
	let Lif 	=0;
	let Sub 	=100;	
	let Ext 	=0;
	let Ext_c	=0;
	let Sub_Max 	=100;
	let Ext_Max 	=20000;

	let csd		=GetCurrentScriptDirectory;
	let BG1_1	=csd~"\bg\BG1_1.png";
	let BG1_2	=csd~"\bg\BG1_2.png";
	let BG1_3	=csd~"\bg\BG1_3.png";
	let BG2_1	=csd~"\bg\BG2_1.png";
	let BG2_2l	=csd~"\bg\BG2_2l.png";
	let BG2_2r	=csd~"\bg\BG2_2r.png";
	let BG2_3l	=csd~"\bg\BG2_3l.png";
	let BG2_3r	=csd~"\bg\BG2_3r.png";
	let BG2_3	=csd~"\bg\BG2_3.png";
	let BG3_1	=csd~"\bg\BG3_1.png";
	let BG3_2	=csd~"\bg\BG3_2.png";
	let BG4_1	=csd~"\bg\BG4_1.png";
	let BG4_2	=csd~"\bg\BG4_2.png";

	let B_11	=csd~"\boss\tewi\img\maho1.png";
	let B_12	=csd~"\boss\tewi\img\maho2.png";

	let bgm1	=csd~"\BGM\bgm1.wav";
	let bgm2	=csd~"\BGM\bgm2.wav";
	let bgm3	=csd~"\BGM\bgm3.wav";
	let bgm4	=csd~"\BGM\bgm4.wav";
	let bgm5	=csd~"\BGM\bgm5.wav";
	let bgm6	=csd~"\BGM\bgm6.wav";
	let imgEnemy1	=csd~"\zako\img\yosei1.png";
	let imgEnemy2	=csd~"\zako\img\yosei2.png";
	let imgEnemy3	=csd~"\zako\img\yosei3.png";
	let imgEnemy4	=csd~"\zako\img\yosei4.png";
	let imgEnemy5	=csd~"\zako\img\yosei5.png";
	let imgresult	=csd~"\bg\clear.png";
	let imgmh	=csd~"\zako\img\mh.png";
	let imgrate	=csd~"\data\img\rate.png";
	let BG_t	=csd~"\data\img\BG_t.png";
	let BG_t2	=csd~"\data\img\BG_t2.png";
	let t_frame	=csd~"\data\img\frame.png";
	let p_frame	=csd~"\data\img\frame_p.png";
	let taitle	=csd~"\data\img\taitle_p.png";
	let taitle_m	=csd~"\data\img\taitle_m.png";
	let taitle_mb	=csd~"\data\img\taitle_mb.png";
	let taitle_ps	=csd~"\data\img\taitle_ps.png";
	let VALUE_IMG	=csd~"\data\img\frame_p.png";
	let STG_Frame	=csd~"\data\img\frame.png";
	#include_function csd~".\data\zako_f.txt"
	#include_function csd~".\data\taitle.txt"
	#include_function csd~".\data\Frame.txt"
	//#include_function csd~".\data\Result.txt"
	@Initialize()
	{
		ExpertEx(false,0,3);
		SetCommonData("NoShot",0);
		SetCommonData("jiki",0);
		SetCommonData("pppCount",0);
		SetCommonData("sw_gCount",0);
		SetCommonData("t_pCount",0);
		SetRateScoreSystemEnable(false);
		LoadGraphic(imgEnemy1);
		LoadGraphic(imgEnemy2);
		LoadGraphic(imgEnemy3);
		LoadGraphic(imgEnemy4);
		LoadGraphic(imgEnemy5);
		LoadGraphic(imgrate);
		LoadGraphic(imgmh);
		LoadGraphic(t_frame);
		LoadGraphic(p_frame);
		LoadGraphic(taitle);
		LoadGraphic(taitle_m);
		LoadGraphic(taitle_mb);
		LoadGraphic(taitle_ps);
		LoadGraphic(VALUE_IMG);
		LoadGraphic(STG_Frame);
		LoadGraphic(BG1_1);
		LoadGraphic(BG1_2);
		LoadGraphic(BG1_3);
		LoadGraphic(BG2_2l);
		LoadGraphic(BG2_2r);
		LoadGraphic(BG2_3l);
		LoadGraphic(BG2_3r);
		LoadGraphic(BG2_3);
		LoadGraphic(BG_t);
		LoadGraphic(BG_t2);
		LoadGraphic(B_11);
		LoadGraphic(B_12);
		LoadMusic(bgm1);
		LoadMusic(bgm2);
		TMain;
		}

	task TMain{
	yield;
	ExtendPlayer(2 - GetPlayerLife);
	STG_Frame_Draw;
	Player_Life_Draw;
	Counter_Draw;
	Score_Draw;
	SubWepon_Draw;
	Extend_Draw;
	NoShot1=1;
	frame;
	p_life;
	Taitle;
	alp_t;
	StageTask;
	}

	sub Taitle{
	loop(51){
	Alpha_tm+=5;
	yield;
	}
	loop{
	yield;
	if(GetKeyState(VK_SHOT)==KEY_PUSH||GetKeyState(VK_SHOT)==KEY_HOLD){break;}
	}
	loop(51){
	Alpha_tm-=5;
	Alpha_tmb-=5;
	yield;
	}
	ForbidShot(true);
	loop{
	yield;
	if(GameStart==0){
	TAITLE_KEY;
	SetPlayerX(cx);
	SetPlayerY(cy+160);
	}
	if(GameStart==1){
	DeleteGraphic(BG_t2);
	break;
	Compile;
	}
	}
	}

	task Compile{

	/*CompileEnemyFromFile(csd~"\zako\normal\Z01.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z02.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z03.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z04.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z07.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z08.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z09.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z10.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z11.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z12.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z13.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z14.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z15.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z16.txt");*/


	/*CompileEnemyFromFile(csd~"\zako\normal\Z01.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z02.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z03.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z04.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z07.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z08.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z09.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z10.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z11.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z12.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z13.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z14.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z15.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z16.txt");*/


	/*CompileEnemyFromFile(csd~"\zako\normal\Z01.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z02.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z03.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z04.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z07.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z08.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z09.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z10.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z11.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z12.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z13.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z14.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z15.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z16.txt");*/


	/*CompileEnemyFromFile(csd~"\zako\normal\Z01.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z02.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z03.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z04.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z07.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z08.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z09.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z10.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z11.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z12.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z13.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z14.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z15.txt");
	CompileEnemyFromFile(csd~"\zako\normal\Z16.txt");*/

	}

	function wait(let frame)
	{
			loop(frame){yield};
	}

	function waitForZeroEnemy()
	{
			while(GetEnemyNum() != 0){yield;}
	}

	function RealToIntString(let num){
	if(num<0){num=0;}
	let stringarray=["0","1","2","3","4","5","6","7","8","9"];
	let lp=floor(log10(num))+1;
	let lp1=lp;
	if(lp<=0){result="0"}
	else{
	result = "";
	loop(lp){
	result=result~ stringarray[(num%(10^lp1)-num%(10^(lp1-1)))/(10^(lp1-1))];
	lp1--;
	}
	}
	}	

	task StageTask
	{
	wait(30);
	ForbidShot(false);
	NoShot1=0;
	wait(30);
	PlayMusic(bgm1);
	loop(102){
	Alpha_BG_12+=2.5;
	Alpha_BG_11+=2.5;
	yield;
	}
	wait(30);
	if(NORMAL==1){
	#include_function ".\data\stage1.txt"
	//NextStage();
	//#include_function ".\data\stage2.txt"
	//NextStage();
	//#include_function ".\data\stage3.txt"
	//NextStage();
	}
	else if(EXTRA==1){
	#include_function ".\data\stage4.txt"
	//NextStage();
	}
	}

	@MainLoop()
	{
		yield;
		ForbidBomb(true);
		mCount++;
	if(REI==1){
	SetCommonData("jiki",1);
	}
	if(SAKU==1){
	SetCommonData("jiki",2);
	}
	if(MARI==1){
	SetCommonData("jiki",3);
	}
		SetCommonData("NoShot",NoShot1);

		Ext=GetGraze;
		if(Ext >= Ext_Max){
		ExtendPlayer(1);
		AddGraze(-GetGraze);
		}
		if(GetPlayerLife > 6){ ExtendPlayer(6 - GetPlayerLife); }	//	vC[Ct̏
		Lif = GetPlayerLife;						//	LifϐɌ݂̃vC[
		Scr = GetScore;						//	ScrϐɌ݂̃XRA
		//	VKǉ
		if(GetScore >= 1000000000){ SOv ++; AddScore(-1000000000);}	//	XRAẺ
		//	VKǉ
		if(SOv > 9999){ SOv = 9999; Scr = 999999999; }	//	XRȀ9,999,999,999,999_


		Cnt = GetCommonData("pppCount");						//	CntϐɌ݂̃OCY
		//	VKǉ
		if(Cnt >= 999999){ Cnt = 999999; }				//	Cntϐ̏999,999_
		Sub=GetCommonData("sw_gCount")

	}



	@DrawTopObject{
	if(Alpha_t<=255){ICO;}
	SetGraphicRect(0,0,384,448);
	SetTexture(taitle_mb);
	SetGraphicScale(1,1);
	SetAlpha(Alpha_tmb);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );
	SetGraphicRect(0,0,384,448);
	SetTexture(taitle_m);
	SetGraphicScale(1,1);
	SetAlpha(Alpha_tm);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );
	}


	@Finalize()
	{
		DeleteGraphic(imgEnemy1);
		DeleteGraphic(imgEnemy2);
		DeleteGraphic(imgEnemy3);
		DeleteGraphic(imgEnemy4);
		DeleteGraphic(imgEnemy5);
		DeleteGraphic(imgmh);
	}
	let BG_k	=0;
	let BG11_y	=0;
	let BG12_y	=0;
	let BG13_y	=0;
	let BG21_y	=0;
	let BG21_y2	=-2;
	let BG22_y	=0;
	let BG23_y	=0;
	let BG31_y	=0;
	let BG32_y	=0;
	let BG23_x	=0;
	let kkdi_11	=1;
	let kkdi_12	=1;
	let kkdi_21	=0.1;
	let kkdi_23	=0.5;
	let Alpha_BG_11	=0;
	let Alpha_BG_12	=0;
	let Alpha_BG_21	=0;
	let Alpha_BG_23	=0;
	let Alpha_BG_31	=0;


	@BackGround {
	if(GameStart==1){

	BG11_y	=-2;
	BG12_y	=-3;
	BG13_y	=-1.5;
	let nY2 = (mCount * BG13_y)%512;
	SetGraphicRect(0,nY2,384,512+nY2);
	SetTexture(BG1_3);
	SetGraphicScale(kkdi_11,kkdi_11);
	SetAlpha(Alpha_BG_11);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );
	let nY2 = (mCount * BG11_y)%512;
	SetGraphicRect(0,nY2,384,512+nY2);
        SetTexture(BG1_1);
	SetGraphicScale(kkdi_11,kkdi_11);
	SetAlpha(Alpha_BG_11);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );
	let nY2 = (mCount * BG12_y)%512;
	SetGraphicRect(0,nY2,384,512+nY2);
	SetTexture(BG1_2);
	SetGraphicScale(kkdi_12,kkdi_12);
	SetAlpha(Alpha_BG_12);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );

	//1
	BG23_y	=-1.5;
	let nY22 = (mCount * BG23_y)%512;
	SetGraphicRect(0,nY22,384,1024+nY22);
	SetTexture(BG2_3r);
	SetGraphicScale(1,1);
	SetAlpha(Alpha_BG_23);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX+BG23_x, GetCenterY);
	//2
	let nY22 = (mCount * BG23_y)%512;
	SetGraphicRect(0,nY22,384,1024+nY22);
	SetTexture(BG2_3l);
	SetGraphicScale(1,1);
	SetAlpha(Alpha_BG_23);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX+BG23_x, GetCenterY);

	BG2a;//ʂ̍Ẽc̃^XN

	BG21_y	=-4;
	let nY21 = (mCount * BG21_y)%512;
	SetGraphicRect(0,nY21,384,512+nY21);
	SetTexture(BG2_3);
	SetGraphicScale(2,2);
	SetAlpha(Alpha_BG_21*0.6);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );

	BG31_y	=-9;
	BG32_y	=-2;
	let nY31 = (mCount * BG31_y)%512;
	SetGraphicRect(0,nY31,384,512+nY31);
	SetTexture(BG3_1);
	SetGraphicScale(1,1);
	SetAlpha(Alpha_BG_31);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );
	let nY32 = (mCount * BG32_y)%512;
	SetGraphicRect(0,nY32,384,512+nY32);
	SetTexture(BG3_2);
	SetGraphicScale(1,1);
	SetAlpha(Alpha_BG_31);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );

	/*else if(stage==4){
	BG1_y	=-9;
	BG2_y	=0;
	let nY1 = (mCount * BG1_y)%512;
	SetGraphicRect(0,nY1,384,512+nY1);
	SetTexture(BG4_2);
	SetGraphicScale(1,1);
	SetAlpha(Alpha_BG);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );
	let nY2 = (mCount * BG2_y)%512;
	SetGraphicRect(0,nY2,384,512+nY2);
	SetTexture(BG4_1);
	SetGraphicScale(1,1);
	SetAlpha(Alpha_BG);
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX, GetCenterY );
	}*/
	}
	}

task BG2a{
	let BG2c=0;
	let c =4;
	loop(c){
	BG2c+=1/c;
	//BG21_y=BG21_y2;
	let nY21 = (mCount * BG21_y*BG2c)%512;
	SetGraphicRect(0,nY21,372,5120+nY21);
	SetTexture(BG2_2l);
	SetGraphicScale(kkdi_21,kkdi_21);
	SetAlpha(Alpha_BG_21);
	SetColor((160*BG2c),(160*BG2c),(160*BG2c));
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX+(40-(BG2c*90)), GetCenterY );
	SetGraphicRect(0,nY21,372,5120+nY21);
	SetTexture(BG2_2r);
	SetGraphicScale(kkdi_21,kkdi_21);
	SetAlpha(Alpha_BG_21);
	SetColor((160*BG2c),(160*BG2c),(160*BG2c));
	SetGraphicAngle(0,0,0);
	DrawGraphic( GetCenterX-(40-(BG2c*90)), GetCenterY );
	}

}

	task Player_Life_Draw{
		let PlayerLifeObj = [NULL];
		ascent(Life_Max in 0..6){
			PlayerLifeObj = PlayerLifeObj ~ [NULL];
		}
		let PlayerLife = 0;
		loop{
			PlayerLife = Lif;
			if(PlayerLife > 6){ PlayerLife = 6; }
			ascent(Life in 0..PlayerLife){
				PlayerLifeObj[Life] = Obj_Create(OBJ_EFFECT);
				ObjEffect_SetTexture(PlayerLifeObj[Life], VALUE_IMG);
				ObjEffect_SetPrimitiveType(PlayerLifeObj[Life], PRIMITIVE_TRIANGLEFAN);
				ObjEffect_CreateVertex(PlayerLifeObj[Life], 4);
				ObjEffect_SetLayer(PlayerLifeObj[Life], 8);
				ascent(Vertex_Number in 0..4){
					ObjEffect_SetVertexXY(PlayerLifeObj[Life], Vertex_Number, [432, 460, 460, 432][Vertex_Number], [26, 26, 60, 60][Vertex_Number] + 34 * Life);
					ObjEffect_SetVertexUV(PlayerLifeObj[Life], Vertex_Number, [59, 87, 87, 59][Vertex_Number], [0, 0, 34, 34][Vertex_Number]);
					ObjEffect_SetVertexColor(PlayerLifeObj[Life], Vertex_Number, 255, 255, 255, 255);
				}
			}
			yield;
			ascent(Life in 0..PlayerLife){
				Obj_Delete(PlayerLifeObj[Life]);
			}
		}
	}

	task Counter_Draw{
		let Counter_Obj = [NULL];
		ascent(Counter_Max in 0..6){
			Counter_Obj = Counter_Obj ~ [NULL];
		}
		let Value_Pposition_Top = [270, 0, 30, 60, 90, 120, 150, 180, 210, 240];
		let Value_Pposition_Bottom = [300, 30, 60, 90, 120, 150, 180, 210, 240, 270];
		let Length = 1;
		let Value = 0;
		loop{
			ascent(Counter_Max in 0..6){
				if(Cnt >= 10 ^ Counter_Max){ Length = Counter_Max + 1; }
			}
			ascent(Counter in 0..Length){
				Value = truncate(Cnt / (10 ^ Counter) ) % 10;
				Counter_Obj[Counter] = Obj_Create(OBJ_EFFECT);
				ObjEffect_SetTexture(Counter_Obj[Counter], VALUE_IMG);
				ObjEffect_SetPrimitiveType(Counter_Obj[Counter], PRIMITIVE_TRIANGLEFAN);
				ObjEffect_CreateVertex(Counter_Obj[Counter], 4);
				ObjEffect_SetLayer(Counter_Obj[Counter], 8);
				ascent(Vertex_Number in 0..4){
					ObjEffect_SetVertexXY(Counter_Obj[Counter], Vertex_Number, [502, 530, 530, 502][Vertex_Number], [198, 198, 228, 228][Vertex_Number] - 34.5 * Counter);
					ObjEffect_SetVertexUV(Counter_Obj[Counter], Vertex_Number, [0, 28, 28, 0][Vertex_Number], [Value_Pposition_Top[Value], Value_Pposition_Top[Value], Value_Pposition_Bottom[Value], Value_Pposition_Bottom[Value]][Vertex_Number]);
					ObjEffect_SetVertexColor(Counter_Obj[Counter], Vertex_Number, 255, 255, 255, 255);
				}
			}
			ascent(Counter in Length..6){
				Counter_Obj[Counter] = Obj_Create(OBJ_EFFECT);
				ObjEffect_SetTexture(Counter_Obj[Counter], VALUE_IMG);
				ObjEffect_SetPrimitiveType(Counter_Obj[Counter], PRIMITIVE_TRIANGLEFAN);
				ObjEffect_CreateVertex(Counter_Obj[Counter], 4);
				ObjEffect_SetLayer(Counter_Obj[Counter], 8);
				ascent(Vertex_Number in 0..4){
					ObjEffect_SetVertexXY(Counter_Obj[Counter], Vertex_Number, [502, 530, 530, 502][Vertex_Number], [198, 198, 228, 228][Vertex_Number] - 34.5 * Counter);
					ObjEffect_SetVertexUV(Counter_Obj[Counter], Vertex_Number, [60, 88, 88, 60][Vertex_Number], [210, 210, 239, 239][Vertex_Number]);
					ObjEffect_SetVertexColor(Counter_Obj[Counter], Vertex_Number, 255, 255, 255, 255);
				}
			}
			yield;
			ascent(Counter_Max in 0..6){
				Obj_Delete(Counter_Obj[Counter_Max]);
			}
		}
	}


	//	̃^XN͏㏑Ă
	task Score_Draw{
		let Score_Obj = [NULL];
		ascent(Score_Max in 0..13){
			Score_Obj = Score_Obj ~ [NULL];
		}
		let Value_Pposition_Top = [270, 0, 30, 60, 90, 120, 150, 180, 210, 240];
		let Value_Pposition_Bottom = [300, 30, 60, 90, 120, 150, 180, 210, 240, 270];
		let Length_N = 1;
		let Value = 0;
		loop{
			if(!SOv){
				ascent(Score_Max in 0..13){
					if(Scr >= 10 ^ Score_Max){ Length_N = Score_Max + 1; }
				}
			}else{
				ascent(Score_Max in 9..13){
					if(SOv >= 10 ^ (Score_Max - 9)){ Length_N = Score_Max + 1; }
				}
			}
			if(!SOv){
				ascent(Score in 0..Length_N){
					Value = truncate(Scr / (10 ^ Score) ) % 10;
					Score_Obj[Score] = Obj_Create(OBJ_EFFECT);
					ObjEffect_SetTexture(Score_Obj[Score], VALUE_IMG);
					ObjEffect_SetPrimitiveType(Score_Obj[Score], PRIMITIVE_TRIANGLEFAN);
					ObjEffect_CreateVertex(Score_Obj[Score], 4);
					ObjEffect_SetLayer(Score_Obj[Score], 8);
					ascent(Vertex_Number in 0..4){
						ObjEffect_SetVertexXY(Score_Obj[Score], Vertex_Number, [572, 600, 600, 572][Vertex_Number], [438, 438, 468, 468][Vertex_Number] - 34.35 * Score);
						ObjEffect_SetVertexUV(Score_Obj[Score], Vertex_Number, [0, 28, 28, 0][Vertex_Number], [Value_Pposition_Top[Value], Value_Pposition_Top[Value], Value_Pposition_Bottom[Value], Value_Pposition_Bottom[Value]][Vertex_Number]);
						ObjEffect_SetVertexColor(Score_Obj[Score], Vertex_Number, 255, 255, 255, 255);
					}
				}
				ascent(Score in Length_N..13){
					Score_Obj[Score] = Obj_Create(OBJ_EFFECT);
					ObjEffect_SetTexture(Score_Obj[Score], VALUE_IMG);
					ObjEffect_SetPrimitiveType(Score_Obj[Score], PRIMITIVE_TRIANGLEFAN);
					ObjEffect_CreateVertex(Score_Obj[Score], 4);
					ObjEffect_SetLayer(Score_Obj[Score], 8);
					ascent(Vertex_Number in 0..4){
						ObjEffect_SetVertexXY(Score_Obj[Score], Vertex_Number, [572, 600, 600, 572][Vertex_Number], [438, 438, 468, 468][Vertex_Number] - 34.35 * Score);
						ObjEffect_SetVertexUV(Score_Obj[Score], Vertex_Number, [60, 88, 88, 60][Vertex_Number], [210, 210, 239, 239][Vertex_Number]);
						ObjEffect_SetVertexColor(Score_Obj[Score], Vertex_Number, 255, 255, 255, 255);
					}
				}
			}else{
				ascent(Score in 0..9){
					Value = truncate(Scr / (10 ^ Score) ) % 10;
					Score_Obj[Score] = Obj_Create(OBJ_EFFECT);
					ObjEffect_SetTexture(Score_Obj[Score], VALUE_IMG);
					ObjEffect_SetPrimitiveType(Score_Obj[Score], PRIMITIVE_TRIANGLEFAN);
					ObjEffect_CreateVertex(Score_Obj[Score], 4);
					ObjEffect_SetLayer(Score_Obj[Score], 8);
					ascent(Vertex_Number in 0..4){
						ObjEffect_SetVertexXY(Score_Obj[Score], Vertex_Number, [572, 600, 600, 572][Vertex_Number], [438, 438, 468, 468][Vertex_Number] - 34.35 * Score);
						ObjEffect_SetVertexUV(Score_Obj[Score], Vertex_Number, [0, 28, 28, 0][Vertex_Number], [Value_Pposition_Top[Value], Value_Pposition_Top[Value], Value_Pposition_Bottom[Value], Value_Pposition_Bottom[Value]][Vertex_Number]);
						ObjEffect_SetVertexColor(Score_Obj[Score], Vertex_Number, 255, 255, 255, 255);
					}
				}
				ascent(Score in 9..Length_N){
					Value = truncate(SOv / (10 ^ (Score - 9)) ) % 10;
					Score_Obj[Score] = Obj_Create(OBJ_EFFECT);
					ObjEffect_SetTexture(Score_Obj[Score], VALUE_IMG);
					ObjEffect_SetPrimitiveType(Score_Obj[Score], PRIMITIVE_TRIANGLEFAN);
					ObjEffect_CreateVertex(Score_Obj[Score], 4);
					ObjEffect_SetLayer(Score_Obj[Score], 8);
					ascent(Vertex_Number in 0..4){
						ObjEffect_SetVertexXY(Score_Obj[Score], Vertex_Number, [572, 600, 600, 572][Vertex_Number], [438, 438, 468, 468][Vertex_Number] - 34.35 * Score);
						ObjEffect_SetVertexUV(Score_Obj[Score], Vertex_Number, [0, 28, 28, 0][Vertex_Number], [Value_Pposition_Top[Value], Value_Pposition_Top[Value], Value_Pposition_Bottom[Value], Value_Pposition_Bottom[Value]][Vertex_Number]);
						ObjEffect_SetVertexColor(Score_Obj[Score], Vertex_Number, 255, 255, 255, 255);
					}
				}
				ascent(Score in Length_N..13){
					Score_Obj[Score] = Obj_Create(OBJ_EFFECT);
					ObjEffect_SetTexture(Score_Obj[Score], VALUE_IMG);
					ObjEffect_SetPrimitiveType(Score_Obj[Score], PRIMITIVE_TRIANGLEFAN);
					ObjEffect_CreateVertex(Score_Obj[Score], 4);
					ObjEffect_SetLayer(Score_Obj[Score], 8);
					ascent(Vertex_Number in 0..4){
						ObjEffect_SetVertexXY(Score_Obj[Score], Vertex_Number, [572, 600, 600, 572][Vertex_Number], [438, 438, 468, 468][Vertex_Number] - 34.35 * Score);
						ObjEffect_SetVertexUV(Score_Obj[Score], Vertex_Number, [60, 88, 88, 60][Vertex_Number], [210, 210, 239, 239][Vertex_Number]);
						ObjEffect_SetVertexColor(Score_Obj[Score], Vertex_Number, 255, 255, 255, 255);
					}
				}
			}
			yield;
			ascent(Score_Max in 0..13){
				Obj_Delete(Score_Obj[Score_Max]);
			}
		}
	}

	task SubWepon_Draw{
		let SubWepon_Obj;
		let Height = Sub_Max / 204;
		loop{
			SubWepon_Obj = Obj_Create(OBJ_EFFECT);
			ObjEffect_SetTexture(SubWepon_Obj, VALUE_IMG);
			ObjEffect_SetPrimitiveType(SubWepon_Obj, PRIMITIVE_TRIANGLEFAN);
			ObjEffect_CreateVertex(SubWepon_Obj, 4);
			ObjEffect_SetLayer(SubWepon_Obj, 8);
			ascent(Vertex_Number in 0..4){
				ObjEffect_SetVertexXY(SubWepon_Obj, Vertex_Number, [440, 452, 452, 440][Vertex_Number], [454 - truncate(Sub / Height), 454 - truncate(Sub / Height), 454, 454][Vertex_Number]);
				ObjEffect_SetVertexUV(SubWepon_Obj, Vertex_Number, [40, 52, 52, 40][Vertex_Number], [204 - truncate(Sub / Height), 204 - truncate(Sub / Height), 204, 204][Vertex_Number]);
				ObjEffect_SetVertexColor(SubWepon_Obj, Vertex_Number, 255, 255, 255, 255);
			}
			yield;
			Obj_Delete(SubWepon_Obj);
		}
	}

	task Extend_Draw{
		let Extend_Obj;
		let Height = Ext_Max / 204;
		loop{
			Extend_Obj = Obj_Create(OBJ_EFFECT);
			ObjEffect_SetTexture(Extend_Obj, VALUE_IMG);
			ObjEffect_SetPrimitiveType(Extend_Obj, PRIMITIVE_TRIANGLEFAN);
			ObjEffect_CreateVertex(Extend_Obj, 4);
			ObjEffect_SetLayer(Extend_Obj, 8);
			ascent(Vertex_Number in 0..4){
				ObjEffect_SetVertexXY(Extend_Obj, Vertex_Number, [510, 522, 522, 510][Vertex_Number], [454 - truncate(Ext / Height), 454 - truncate(Ext / Height), 454, 454][Vertex_Number]);
				ObjEffect_SetVertexUV(Extend_Obj, Vertex_Number, [40, 52, 52, 40][Vertex_Number], [204 - truncate(Ext / Height), 204 - truncate(Ext / Height), 204, 204][Vertex_Number]);
				ObjEffect_SetVertexColor(Extend_Obj, Vertex_Number, 255, 255, 255, 255);
			}
			yield;
			Obj_Delete(Extend_Obj);
		}
	}




	task STG_Frame_Draw{
		let Frame_Obj;
		loop{
			Frame_Obj = Obj_Create(OBJ_EFFECT);
			ObjEffect_SetTexture(Frame_Obj, STG_Frame);
			ObjEffect_SetPrimitiveType(Frame_Obj, PRIMITIVE_TRIANGLEFAN);
			ObjEffect_CreateVertex(Frame_Obj, 4);
			ObjEffect_SetLayer(Frame_Obj, 8);
			ascent(Vertex_Number in 0..4){
				ObjEffect_SetVertexXY(Frame_Obj, Vertex_Number, [0, 640, 640, 0][Vertex_Number], [0, 0, 480, 480][Vertex_Number]);
				ObjEffect_SetVertexUV(Frame_Obj, Vertex_Number, [0, 640, 640, 0][Vertex_Number], [0, 0, 480, 480][Vertex_Number]);
				ObjEffect_SetVertexColor(Frame_Obj, Vertex_Number, 255, 255, 255, 255);
			}
			yield;
			Obj_Delete(Frame_Obj);
		}
	}
	}
